<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<script type="text/javascript">
		var json = {"gids": [1, 2, 3, 4, 5]};
		var gids = json.gids;
		for (var i = 0; i < gids.length; i++) {
			document.writeln(gids[i]);
		}
	
		var o={"xlid":"cxh","xldigitid":123456,"topscore":2000,"topplaytime":"2009-08-20"};
		
		alert("json data:" + o);


		var jsonranklist=[{"xlid":"cxh","xldigitid":123456,"topscore":2000,"topplaytime":"2009-08-20"},{"xlid":"zd","xldigitid":123456,"topscore":1500,"topplaytime":"2009-11-20"}];

		alert(eval(jsonranklist));

		var jsonString = '{ "name": "cxh", "sex": "man" }';

		//var obj = eval('(' + jsonString + ')');
		//var obj = jsonString.parseJSON(); //由JSON字符串转换为JSON对象, 需要json.js
    	var obj = JSON.parse(jsonString); //由JSON字符串转换为JSON对象
    	alert(obj.sex);

		var jsonObject = { "name": "cxh", "sex": "man" };

		alert(jsonObject.name);


		//var last=jsonObject.toJSONString(); //将JSON对象转化为JSON字符, 需要json.js
    	var last=JSON.stringify(obj); //将JSON对象转化为JSON字符
    	alert(last);


	</script>
</body>
</html>